<template>
    <div class="wang-content">
        <span v-html="defaultHtml"></span>
    </div>
</template>

<script setup>
    import {ref} from 'vue'
    import {getGoodsInfoApi} from "@/api/goods/goods";
    import {ElMessage} from "element-plus";
    import {useRoute} from 'vue-router'

    const $route = useRoute()
    const goods_id = ref(0)
    const defaultHtml = ref('')
    //查询商品详情
    const getGoods = () => {
        let queryList = {
            goods_id : goods_id.value
        }
        getGoodsInfoApi(queryList).then(res => {
            if (res.errcode == 0) {
                defaultHtml.value = res.data.content
            } else {
                ElMessage.error('发生错误，稍后再试！')
            }
        })
    }
    if ($route.query.goods_id){
        goods_id.value = $route.query.goods_id;
        //取商品详情
        getGoods()
    }else{
        alert('商品id为空')
    }


</script>
<style lang="scss">
    .wang-content{
        background-color: #fff; padding: 20px; margin: 0 auto;
        img{
            max-width: 100%;
        }
        p{
            width:100%;
            word-break: break-word;
        }
    }
</style>

